"use strict";
cc._RF.push(module, '88b74FLY/ZDd5079G/UmRKk', 'user_order_item');
// scripts/module/user_order_item.js

'use strict';

// Learn cc.Class:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/class.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/class/index.html
// Learn Attribute:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/reference/attributes/index.html
// Learn life-cycle callbacks:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/life-cycle-callbacks/index.html

cc.Class({
    extends: cc.Component,

    properties: {
        labLotteryName: cc.Label, //订单名
        labMoney: cc.Label, //订单价格
        labIsuse: cc.Label, //订单期数
        labType: cc.Label, //订单类型
        labState: cc.Label, //订单状态
        spWin: cc.Node, //中奖显示
        labYMD: cc.Label //年月日显示

    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start: function start() {},


    init: function init(data) {
        if (data != null) {
            this.labLotteryName.string = data.LotteryName;
            var isuse = data.IsuseNum == null ? "" : data.IsuseNum;
            this.labIsuse.string = isuse ? '第' + isuse + '期' : "";
            this.labType.string = data.type;
            this.labMoney.string = data.Money.toString() + "元宝";
            this.labYMD.string = data.Year + '-' + data.Month + '-' + data.Day;

            //订单状态
            if (data.State == 14) {
                this.labState.node.active = false;
                this.spWin.active = true;
            } else {
                this.labState.node.active = true;
                this.spWin.active = false;
                this.labState.string = LotteryUtils.getOrderStatusByStatus(data.State);
                if (LotteryUtils.getOrderStatusByStatus(data.State) == '未中奖') {
                    this.labState.node.color = new cc.Color(59, 133, 255);
                } else {
                    this.labState.node.color = new cc.Color(116, 116, 116);
                }
            }
        }
    }

    // update (dt) {},
});

cc._RF.pop();